package com.xsz.lambdademo;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class ComparatorDemo {

    public static void main(String[] args) {
        List<Double> list = new ArrayList<>();
        list.add(12.3);
        list.add(100.2);
        list.add(3.14);
        list.add(27.7);
        list.add(-9.8);
        //o2.compareTo(o1) 从大到小
        //o1.compareTo(o2) 从小到大
        Collections.sort(list, (o1, o2) -> o2.compareTo(o1));

        System.out.println(list);

    }
}
